import http from '../../util/request.js'

export default {
    //获取会员列表
    add:(obj)=>{
        return http({
            url:'/g/guide',
            method:'POST',
            data:obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    edit:(obj)=>{
        return http({
            url:'/g/guide',
            method:'PUT',
            data:obj,
            headers: {
                //定义将数据以json的形式传入后台(java)
                'Content-Type': 'application/json'
            }
        });
    },
    del:(id)=>{
        return http({
            url:'/g/guide/'+id,
            method:'DELETE'
        });



    },
    page:(obj)=>{
        return http({
            url:'/g/guide/page',
            method:'GET',
            //表单用param
            params:obj
        });
    },
    find:(id)=>{
        return http({
            url:'/g/guide/'+id,
            method:'GET'
        });
    },
    changePassword:(passwordData)=>{
        return http({
            url:'/g/guide/changePassword',
            method:'PUT',
            data:passwordData,
            headers: {
                'Content-Type': 'application/json'
            }
        }).then(response => {
            // 标准化响应格式
            if (typeof response === 'string' && response.includes('密码修改成功')) {
                return {
                    code: 200,
                    msg: '',
                    data: response
                };
            }
            return response;
        })
    },
}